package com.hs.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.hs.entity.Level;
import com.hs.mapper.LevelMapper;
import com.hs.service.LevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName LevelServiceImpl
 * @Description TODO
 * @Author qiuye
 * @Date 2025年08月01日 18:52
 * @Version 1.0
 */
@Service
public class LevelServiceImpl implements LevelService {
    @Autowired
    private LevelMapper levelMapper;
    @Override
    public int addLevel(Level level) {
        return levelMapper.addLevel(level);
    }

    @Override
    public int deleteLevel(int id) {
        return levelMapper.deleteLevel(id);
    }

    @Override
    public int updateLevel(Level level) {
        return levelMapper.updateLevel(level);
    }

    @Override
    public Level getLevel(int id) {
        return levelMapper.getLevel(id);
    }

    @Override
    public PageInfo<Level> getLevels(Level level, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Level> list = levelMapper.getLevels(level);
        PageInfo<Level> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int deletelIds(int[] ids) {
        return levelMapper.deletelIds(ids);
    }
}
